#Tip
import random
target =random.randint(0,9)
n=0
while True:
    try:
        guess=eval(input('请输入一个整数（0到9）：'))
    except:
        print("输入有误，已退出")
        continue
    n=n+1
    if  int(guess)<=0:
        print("输入有误，已退出")
        break
    elif type(guess)!=type(123):
        print("输入有误，已退出")
        break
    elif guess>target:
         print('遗憾！太大了！')
    elif  guess<target:
        print('遗憾！太小了！')
    else:
        print("预测{}次，你猜中了！".format(n))
        break